<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="Study11Source/css/index.css" />
</head>
<body>
<!--
图片切换图片

1. 列表数据使用数组保存

2. v-bind指令可以设置元素属性,比如src

3. v-show和v-if都可以切换元素的显示状态,频繁切换用v-show

-->
<div id="mask">
        <div class="center">
            <h2 class="title">
                <img src="Study11Source/images/logo.png" alt="">
                深圳创维校区环境
            </h2>
            <!-- 图片 -->
            <img :src="imgArr[index]"  alt="" />
            <!-- 左箭头 -->
            <a href="javascript:void(0)"  @click="prev" v-if="index!=0" class="left">
                <img src="Study11Source/images/prev.png" alt="" />
            </a>
            <!-- 右箭头 -->
            <a href="javascript:void(0)" v-show="index<imgArr.length-1" v-if="index<=imgArr.length-1" @click="next" class="right">
                <img src="Study11Source/images/next.png" alt="" />
            </a>
        </div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app = new Vue({
        el:"#mask",
        data:{
            imgArr:[
                "Study11Source/images/00.jpg",
                "Study11Source/images/01.jpg",
                "Study11Source/images/02.jpg",
                "Study11Source/images/03.jpg",
                "Study11Source/images/04.jpg",
                "Study11Source/images/05.jpg",
                "Study11Source/images/06.jpg",
                "Study11Source/images/07.jpg",
                "Study11Source/images/08.jpg",
                "Study11Source/images/09.jpg",
                "Study11Source/images/10.jpg",
            ],
            index:0
        },
        methods:{
            prev:function(){
                this.index--;
            },
            next:function(){
                this.index++;
            }
        }
    });
</script>
</html>